home *** CD-ROM | disk | FTP | other *** search
- Path: news-feed.mci.newscorp.com!usenet
- From: pbe@pobox.com
- Newsgroups: comp.lang.c++,comp.lang.pascal.delphi.misc
- Subject: Re: C++ with Zapp vs. Delphi
- Date: 23 Jan 1996 02:46:41 GMT
- Organization: Phoenix Business Enterprises
- Message-ID: <4e1i6h$v29@klein.delphi.com>
- References: <4coar6$d4n@sun4.bham.ac.uk> <4coip7$69s@news1.usa.pipeline.com> <GK+N9LA3rQAxEwdx@dakal.demon.co.uk>
- NNTP-Posting-Host: 206.15.161.89
- X-To: Richard Linsley Hood <richardlh@dakal.demon.co.uk>
- X-Mailer: SQUID
- X-Registration: $737961
-
- >The comparison of two objects should be done by themselves, 'are you
- >larger, smaller than this object' thus hiding from the list how this is
- >done. Only an object 'knows' how it compares to another object (of the
- >same type). This is quite reasonably a function of the object.
-
- OK here is the Delphi equiv:
- (Not complete or syntactically correct, but you'll see my point)
-
- Type
- TGenericList = class
- Sort;
- Compare(s1, s2); abstract;
- end;
- TStringList = class
- Compare(s1, s2); override;
- end;
- TPictureList = class
- Compare(s1, s2); override;
- end;
-
- procedure TGenericList;
- begin
- ...
- If Compare(s1, s2).... (will call DESCENDENT, since they override)
- ...
- end;
- _
- Pennsylvania: Constructionwealth of Pennsylvania
-
- +------------------------------------------------------------+
- |* Chad Z. Hower - phoenix@pobox.com |
- |* Consultant - Phoenix Business Enterprises |
- | pbe@pobox.com - http://pobox.com/~pbe |
- |* Principal Analyst Programmer - |
- | SCB Computer Technology Inc - czhower@eastman.com |
- |Physically in Church Hill, TN - Logically Not Sure |
- | **** My Opinions are my own, I don't steal them **** |
- +------------------------------------------------------------+
- >>SQUID - The ultimate database reader, and NO limits. #$737961
- **Special Compile: 1.033B (Beta)
-